Skip to content

tools: a directory of the build is made on Windows as idempotently as mkdir -p, so two spellings of one directory made at once no longer fail - #43

Merged
pinhopro merged 1 commit into
mainfrom
fix/asio-upstream-mkdir
Nov 20, 2026

Conversation

@pinhopro

Copy link
Copy Markdown
Contributor

Cause

Job "CI / Own lane (asio, openssl-upstream-msvc-14.5, native)" of run 44690351573 failed its very first action and skipped everything under it, the two upstream suites among them:

        if not exist "bin\third_party" mkdir "bin\third_party"
...failed common.mkdir bin\third_party...
...skipped bin\third_party\msvc-14.5 for lack of bin\third_party...

The 14.3 twin runs the same commands and passed; neither restored OpenSSL from a cache, both built it from scratch. Nothing in tools/openssl/build.py is involved (it only writes inside the configuration directory b2 made before it), and the runner image's move to MSVC 14.52 is unrelated.

b2 makes each directory of a target's path once per spelling of it (common.MkDir dedups by name), and this lane names some directories by two:

  • bin/third_party: absolute for each OpenSSL configuration's own directory (webcpp-third-party.directory roots the build directory at path.pwd), relative for each consumer's openssl-config-<hash>.selected in its variant directory;
  • bin/libs/asio/test/tls: relative for the programs, absolute for the oracle's node-modules.stamp (tools/oracle/oracle.jam).

A dry run of a fresh tree (b2 -n -a toolset=clang libs/asio/test/tls//openssl-upstream) lists common.mkdir bin/third_party and common.mkdir /.../bin/third_party. The two mkdirs are independent, so b2 -j runs them at once. b2's action on Windows is if not exist "d" mkdir "d", which fails when the other action makes the directory between its test and its mkdir (cmd's mkdir of an existing directory exits 1); elsewhere b2 runs mkdir -p, which cannot fail that way. Most other native own lanes (beast, cobalt, trystero, webrtc, hash c-suites) name their bin/libs/... test directories both ways too, through the oracle's stamp; only the MSVC lanes run the Windows action.

Fix

tools/webcpp-mkdir.jam, loaded by tools/webcpp.jam (so every build that imports webcpp, a user's included, has it), gives Windows's action a last line that decides by the directory alone:

if not exist "d\" mkdir "d"
if exist "d\" (exit /b 0) else (exit /b 1)

A mkdir that lost the race is a success; a directory that cannot be made is still a failure. This fixes the failing operation for every spelling and every concurrent creator, rather than one spelling at a time.

Tests

  • New tools/test/mkdir_test.py: dry-runs a project that imports webcpp with b2 believing it is on Windows and checks, for each directory, b2's test and mkdir and the deciding last line. It fails without the module.
  • Under Wine's cmd (msvc-lane image): b2's own action with the directory already made exits 1, the new lines exit 0, and an invalid directory name still exits 1.
  • b2.exe under Wine builds 400 directories, each made under both spellings, with -j64: exit 0, all 800 files written, the new action in the log.
  • tools/test/openssl_test.py (MSVC dry-run cases, one configuration built once, interrupted configuration) and tools/test/webcpp_jam_test.py pass.

The race itself does not reproduce under Wine (its process start-up is far slower than a runner's), so the evidence for the cause is the CI log, the dry run's two spellings and the action's semantics above.

AGENTS.md's b2 facts record the race and the module.

🤖 Generated with Claude Code

… mkdir -p, so that two spellings of one directory made at once no longer fail the second

The asio lane openssl-upstream-msvc-14.5 of CI run 44690351573 failed its first action,
`...failed common.mkdir bin\third_party...`, and skipped everything under it, the two
upstream suites among them; its 14.3 twin, the same commands, passed. b2 makes each
directory of a target's path once per spelling of it (common.MkDir), and the lane names
bin\third_party by two: absolute, for each OpenSSL configuration's own directory
(webcpp-third-party.directory), and relative, for the consumers' selections in their
variant directories; likewise bin\libs\asio\test\tls, relative for the programs and
absolute for the oracle's node-modules.stamp. A dry run of a fresh tree lists both
spellings of each. The two mkdirs are independent, so b2 -j runs them at once, and b2's
action on Windows, `if not exist "d" mkdir "d"`, fails when the other one makes the
directory between its test and its mkdir; elsewhere b2 runs mkdir -p, which does not.

tools/webcpp-mkdir.jam, which webcpp.jam loads, gives Windows's action a last line that
decides by the directory alone, `if exist "d\" (exit /b 0) else (exit /b 1)`: a mkdir that
lost the race is a success, and a directory that cannot be made is still a failure. Under
Wine's cmd, b2's own action with the directory already made exits 1 and the new one 0;
b2.exe under Wine builds 400 directories each made under both spellings with -j64. The new
tools/test/mkdir_test.py dry-runs a project that imports webcpp with b2 believing it is on
Windows and checks the action of each directory; without the module it fails. AGENTS.md's
b2 facts record the race.
@pinhopro
pinhopro merged commit 28eabe8 into main Nov 20, 2026
1 of 12 checks passed
@pinhopro
pinhopro deleted the fix/asio-upstream-mkdir branch November 20, 2026 11:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant